const { json } = require('body-parser');
var express = require('express');
var router = express.Router();
var jwt = require('jsonwebtoken');

router.get('/', (req, res, next) => {
  res.render('index', {
    title: "users",
    message: {
      t1: '1',
      t2: '2',
      t3: '3',
    }
  })
});

/* GET users listing. */
/**
 * JSON parameters require a model. This one just has "name"
 * @typedef User
 * @property {string} username - name of person making request
 * @property {string} password - password of person making request
 */
/**
 * This function comment is parsed by doctrine
 * @route POST /users/getUser
 * @summary 获取用户
 * @group User - Operations about user
 * @param {User.model} User.body.required - username or email
 * @returns {object} 200 - An array of user info
 * @returns {Error}  default - Unexpected error
 */
router.post('/getUser', (req, res, next) => {
  console.log("user=", req.body)
  let resBack = req.body;
  resBack.token = 
  res.json(req.body)
});

module.exports = router;